package com.ruoyi.supermarket.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.supermarket.domain.Xqyspay;
import com.ruoyi.supermarket.service.IXqyspayService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 详情应收Controller
 * 
 * @author ruoyi
 * @date 2024-05-30
 */
@RestController
@RequestMapping("/supermarket/xqyspay")
public class XqyspayController extends BaseController
{
    @Autowired
    private IXqyspayService xqyspayService;

    /**
     * 查询详情应收列表
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyspay:list')")
    @GetMapping("/list")
    public AjaxResult list(Xqyspay xqyspay)
    {
//        startPage();
        List<Xqyspay> list = xqyspayService.selectXqyspayList(xqyspay);
        return success(list);
    }

    /**
     * 导出详情应收列表
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyspay:export')")
    @Log(title = "详情应收", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Xqyspay xqyspay)
    {
        List<Xqyspay> list = xqyspayService.selectXqyspayList(xqyspay);
        ExcelUtil<Xqyspay> util = new ExcelUtil<Xqyspay>(Xqyspay.class);
        util.exportExcel(response, list, "详情应收数据");
    }

    /**
     * 获取详情应收详细信息
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyspay:query')")
    @GetMapping(value = "/{xqyspayId}")
    public AjaxResult getInfo(@PathVariable("xqyspayId") Long xqyspayId)
    {
        return success(xqyspayService.selectXqyspayByXqyspayId(xqyspayId));
    }

    /**
     * 新增详情应收
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyspay:add')")
    @Log(title = "详情应收", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Xqyspay xqyspay)
    {
        return toAjax(xqyspayService.insertXqyspay(xqyspay));
    }

    /**
     * 修改详情应收
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyspay:edit')")
    @Log(title = "详情应收", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Xqyspay xqyspay)
    {
        return toAjax(xqyspayService.updateXqyspay(xqyspay));
    }

    /**
     * 删除详情应收
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyspay:remove')")
    @Log(title = "详情应收", businessType = BusinessType.DELETE)
	@DeleteMapping("/{xqyspayIds}")
    public AjaxResult remove(@PathVariable Long[] xqyspayIds)
    {
        return toAjax(xqyspayService.deleteXqyspayByXqyspayIds(xqyspayIds));
    }
}
